﻿using System;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;

namespace YJKArch.LeadToLeader
{
	[Transaction(TransactionMode.Manual)]
	[Regeneration(RegenerationOption.Manual)]
	[Journaling(JournalingMode.NoCommandData)]
	public static class Uint
	{
		public static double FeetTomm(DisplayUnitType to, double value)
		{
			return value *= Uint.ImperialDutRatio(to);
		}

		public static double mmToFeet(double value, DisplayUnitType from)
		{
			return value /= 304.8;
		}

		private static double ImperialDutRatio(DisplayUnitType dut)
		{
			switch ((int)dut)
			{
			case 0:
				return 0.3048;
			case 1:
				return 30.48;
			case 2:
				return 304.8;
			case 3:
				return 1.0;
			case 4:
				return 1.0;
			case 5:
				return 12.0;
			case 6:
				return 12.0;
			case 9:
				return 0.3048;
			}
			return 1.0;
		}
	}
}
